package org.traccar.protocol;

import org.junit.jupiter.api.Test;
import org.traccar.ProtocolTest;

public class JmakFrameDecoderTest extends ProtocolTest {

    @Test
    public void testDecode() throws Exception {

        var decoder = new JmakFrameDecoder();

        verifyFrame(
                binary("7e303030303030303431464533464646463b3233333333332d33333333332d333333333333333b3836383639353036303731353031363b383232343b4e554c4c3b313735303638393932383532303b2d31392e38383234353b2d34332e39373835333b3833372e31303b423b302e30363b31383b33313b302e38393b302e30303b313b303b35322e35303b342e37343b31313735303b333837353b54494d423b343b313735303638393932383533343b313b393b303b302e30307c303030303030303030303030343144463b3138302e30303b3231312e30303b3230382e30303b3139302e30303b373b35303b503b38303b363924"),
                decoder.decode(null, null, binary("7e303030303030303431464533464646463b3233333333332d33333333332d333333333333333b3836383639353036303731353031363b383232343b4e554c4c3b313735303638393932383532303b2d31392e38383234353b2d34332e39373835333b3833372e31303b423b302e30363b31383b33313b302e38393b302e30303b313b303b35322e35303b342e37343b31313735303b333837353b54494d423b343b313735303638393932383533343b313b393b303b302e30307c303030303030303030303030343144463b3138302e30303b3231312e30303b3230382e30303b3139302e30303b373b35303b503b38303b363924")));

        verifyFrame(
                binary("7b22636e74223a31303631302c22735f6e756d223a223233333333332d33333333332d33333333333333222c227473223a313735313032363133303534352c22677073223a5b2d31392e38383234392c2d34332e39373835355d2c22616c74223a3835302e34302c227370656564223a302e30302c226e736174223a31382c2268646f70223a302e38372c22617a69223a302e30302c22697665223a302c2272737369223a33312c22657674223a7b7d2c2262636b7570223a302c22686f75726d74223a36312e32352c226f646f6d74223a342e38382c22747570223a312c22666978223a312c226f7065223a2254494d42222c22746563223a342c22626174223a333838322c2276696e223a302c22696f73223a302c226e616d65223a22222c22696d6569223a3836383639353036303731353031362c22746167223a302c22616e696e223a302e30302c2274735f6e223a313735313032363133303535347d"),
                decoder.decode(null, null, binary("7b22636e74223a31303631302c22735f6e756d223a223233333333332d33333333332d33333333333333222c227473223a313735313032363133303534352c22677073223a5b2d31392e38383234392c2d34332e39373835355d2c22616c74223a3835302e34302c227370656564223a302e30302c226e736174223a31382c2268646f70223a302e38372c22617a69223a302e30302c22697665223a302c2272737369223a33312c22657674223a7b7d2c2262636b7570223a302c22686f75726d74223a36312e32352c226f646f6d74223a342e38382c22747570223a312c22666978223a312c226f7065223a2254494d42222c22746563223a342c22626174223a333838322c2276696e223a302c22696f73223a302c226e616d65223a22222c22696d6569223a3836383639353036303731353031362c22746167223a302c22616e696e223a302e30302c2274735f6e223a313735313032363133303535347d")));

        verifyFrame(
                binary("5e000000041fe3ffff038f752d0082352d32dcd500031612d4831608000029740000000000000000000000000197b14b5c40001e569900431b21014a780b00003b131f0044000000010000000017ed00000001e82df90f3054494d420400000197b14b5c4d010100000000000000000000000000000000405c0000000000000000002824"),
                decoder.decode(null, null, binary("5e000000041fe3ffff038f752d0082352d32dcd500031612d4831608000029740000000000000000000000000197b14b5c40001e569900431b21014a780b00003b131f0044000000010000000017ed00000001e82df90f3054494d420400000197b14b5c4d010100000000000000000000000000000000405c0000000000000000002824")));

    }

}
